// ---------------------------------------------------------------------------------------------------------------------
// GLOBAL_PREDICTION_TABLE.h
// ---------------------------------------------------------------------------------------------------------------------
// Project:	Alpha Branch Predictor
// Authors:	Jabeer Ahmed, 
// 			Omar Mohsin, 
// 			Fadi Butti
// Course:	ECE - 586 (Winter 2013)
// Prof:	Mark Faust
// Portland State University
// ---------------------------------------------------------------------------------------------------------------------

#ifndef __GLOBAL_PREDICTION_TABLE_H__
#define __GLOBAL_PREDICTION_TABLE_H__

#include "types.h"
#include "shift_registers.h"
#include "counters.h"

#define GLOBAL_TABLE_SIZE 4096
#define GLOBAL_TABLE_INDX(indx) indx & (GLOBAL_TABLE_SIZE - 1)

using namespace std;

class global_prediction_table {
	counter2 *table;
public:
	global_prediction_table(){
		table = new  counter2[GLOBAL_TABLE_SIZE];
	}
	~global_prediction_table(){
		delete table;
	}
	counter2& operator[] (uint indx){
		return table[GLOBAL_TABLE_INDX(indx)];
	} 
};

class choice_prediction {
	counter2 *table;
public:
	choice_prediction(){
		table = new  counter2[GLOBAL_TABLE_SIZE];
	}
	~choice_prediction(){
		delete table;
	}
	counter2& operator[] (uint indx){
		return table[GLOBAL_TABLE_INDX(indx)];
	} 
};


#endif 	// __GLOBAL_PREDICTION_TABLE_H__